package com.bytebuddytest.classvisitor;

import com.asmtest.visitor.MyAnnotation;

import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.Stack;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicIntegerArray;
import java.util.concurrent.atomic.AtomicReferenceArray;

/**
 * @author yutianhong
 * @version 1.0
 * @since 2023/12/20 17:29
 */
public class TestClass<T extends LinkedHashMap<Short, ?>, N extends ConcurrentHashMap<?, ?>, M> extends SuperClass<Character> {

    Set<ComponentClass> componentSet;
    List<Map<ComponentComponentClass, Integer>> mapList;
    Map<Float, Set<List<Byte>>> floatSetMap;
    Queue<? extends List<int[]>> listQueue;
    Stack<?> stack;
    Iterator<GenericClass> objectIterator;
    CopyOnWriteArraySet<T> copyOnWriteArraySet;
    ConcurrentHashMap<N, M> concurrentHashMap;
    CopyOnWriteArrayList<? super Map<GenericGenericClass, ?>> copyOnWriteArrayList;
    List<TestClass<T, N, Object>> circleField1;
    List<TestClass<?, ?, Object>> circleField2;
    List<TestClass<T, N, TestClass>> circleField3;

    Object object;
    T tGenericField;
    N nGenericField;
    M mGenericField;

    public void setObject(Object object) throws Exception {
        this.object = object;
    }

    @MyAnnotation(name = "bar", desc = "test method")
    public <T extends List<?>, N> Map<String, T> bar(
            @MyAnnotation(name = "qux", desc = "test param") String qux,
            @MyAnnotation(name = "b") int b,
            @MyAnnotation(name = "generic1") Map<Integer, Float> map,
            @MyAnnotation(name = "generic2") Set<List<Long>> set,
            @MyAnnotation(name = "genericT") T t,
            @MyAnnotation(name = "generic_complexSet") Set<Map<String, Map<List<String>, Long>>> complexSet,
            @MyAnnotation(name = "with_?") List<?> l1,
            @MyAnnotation(name = "with_T") List<T> l2,
            @MyAnnotation(name = "extends") List<? extends Number> l3,
            @MyAnnotation(name = "super") List<? super Set<?>> l4,
            @MyAnnotation(name = "ListT") List<List<T>> l5,
            @MyAnnotation(name = "genericN") N n,
            @MyAnnotation(name = "listN1") List<N> listN,
            @MyAnnotation(name = "listN2") List<List<N>> listN2) {
        return null;
    }

    public SuperClass<List<String>> testMethod(TestClass<LinkedHashMap<Short, Character>, ?, T> input) {
        return null;
    }

    public Result<Page<ModelDTO>> saveModel(SaveModelRequest request, ModelDTO modelDTO, Object... args) {
        return null;
    }

    public void fakeCircle(Result<Page<Result>> r) throws Throwable {
    }

    public void circle(Circle circle) throws IllegalArgumentException, IOException {
    }
}

class ComponentClass {
    AtomicInteger atomicInteger;
    AtomicIntegerArray atomicIntegerArray;
    AtomicReferenceArray<String> atomicReferenceArray;
}

class ComponentComponentClass {
    int intField;
    private byte byteField;
    protected short shortField;
    public boolean booleanField;
    static long longField;
    volatile char charField;
    transient double doubleField;
    final float floatField = 0.0f;
}

class GenericClass {
    Date date;
    Locale locale;
    LocalDateTime localDateTime;
    LocalDate localDate;
    LocalTime localTime;
}

class GenericGenericClass {
    int[] intArr;
    byte[] byteArr;
    float[] floatArr;

}

class SuperClass<T> {
    T superGeneric;
    ComponentClass superField;

    private static Integer superInteger;
    public volatile Long superLong;
    protected transient Boolean superBoolean;
}

class Result<T> {
    String message;
    String code;
    T content;
}

class Page<T> {
    Integer count;
    Integer page;
    Integer pageSize;
    List<T> data;
}

class BaseRequest {
    Long tenantId;
    String productCode;
}

class SaveModelRequest extends BaseRequest {
    String modelCode;
    String modelName;
}

class BaseDTO {
    Long id;
    String modifier;
}

class ModelDTO extends BaseDTO {
    String modelCode;
    String modelName;
    ModelType modelType;
    List<ModelFieldDTO> modelField;
}

class ModelFieldDTO extends BaseDTO {
    String fieldCode;
    String fieldType;
    String fieldName;
}

enum ModelType {
    AECP
}

class Circle<T> {
    T a;
    Circle circle;
}